<script lang="ts">
//类型推断
import {defineComponent} from 'vue'
import MyHead from './02_head.vue'

type Count = number|string

interface List {
  username:string
  age:number
}

export default defineComponent({
  name: "01_选项式api与ts",
  data(){
    return{
      //断言
      count:0 as Count,
      list : [{username:'123',age:123}]
    }
  },
  components:{
    MyHead
  },
  methods:{
    getData(payload:string){
      console.log(payload)
    }
  }
})
</script>

<template>
  <div>
    <h2>hello 02</h2>
    <my-head :count = "count" :list="list" @get-data="getData"></my-head>
  </div>

</template>

<style scoped>

</style>